unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzButton, ExtCtrls, RzPanel, StdCtrls, RzEdit, Mask,FormEx_View,
  rtcInfo, rtcConn, rtcTcpCli,
  RzTabs;

type
  TForm1 = class(TFormExView)
    Tool_1: TRzToolbar;
    Btnx_1: TRzBitBtn;
    Memo_1: TRzMemo;
    Edit_Addr: TRzEdit;
    Edit_Port: TRzEdit;
    RtcTcpClient1: TRtcTcpClient;
    Page_1: TRzPageControl;
    rztbshtTabSheet1: TRzTabSheet;
    rztbshtTabSheet2: TRzTabSheet;
    Memo_2: TRzMemo;
    Btnx_2: TRzBitBtn;
    procedure Btnx_1Click(Sender: TObject);
    procedure RtcTcpClient1DataReceived(Sender: TRtcConnection);
    procedure Btnx_2Click(Sender: TObject);
  private
  protected
    procedure SetInitialize;override;
    procedure SetCommParams;override;
    procedure SetGridParams;override;
    procedure SetComboItems;override;
    procedure TryFreeAndNil;override;
  public
  end;

var
  Form1: TForm1;

implementation

uses
  Class_KzDebug,Class_KzUtils;

{$R *.dfm}

{ TForm1 }

procedure TForm1.SetComboItems;
begin
  inherited;

end;

procedure TForm1.SetCommParams;
var
  ListA:TStringList;
  TextA:string;
begin
  inherited;
  Edit_Addr.Text:='localhost';
  Edit_Port.Text:='906';


  ListA:=TStringList.Create;
  ListA.LoadFromFile(TKzUtils.ExePath+'8620-8621-to-6201.4003064321 in2out.dmp');
  TextA:=ListA.Strings[0];
  //TextA:=TextA+TextA+TextA+TextA+TextA+TextA+TextA+TextA;
  Memo_1.Lines.Add(TextA);
  FreeAndNil(ListA);
end;

procedure TForm1.SetGridParams;
begin
  inherited;

end;

procedure TForm1.SetInitialize;
begin
  inherited;

end;

procedure TForm1.TryFreeAndNil;
begin
  inherited;

end;

procedure TForm1.Btnx_1Click(Sender: TObject);
var
  TextA:string;
begin
  TextA:=Memo_1.Lines.Text;
  TextA:=Copy(TextA,1,2123);
  KzDebug.FileFmt('leng:%D',[Length(TextA)]);

  RtcTcpClient1.ServerAddr:=Trim(Edit_Addr.Text);
  RtcTcpClient1.ServerPort:=Trim(Edit_Port.Text);
  RtcTcpClient1.Connect(True,True);

  RtcTcpClient1.Write(TextA);
end;

procedure TForm1.RtcTcpClient1DataReceived(Sender: TRtcConnection);
begin
  Memo_2.Lines.Add(Sender.Read);
end;

procedure TForm1.Btnx_2Click(Sender: TObject);
begin
  Memo_2.Lines.Clear;
end;

end.
